﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using SHOOTER.Managers;

namespace SHOOTER.Entities
{
    class Gunman
    { 
        Game mGame;
        MouseManager mMouseManager = MouseManager.Instance;

        SpriteBatch mSprite;
        Texture2D mTexture;

        public Vector2 mCrossPos;
        public Vector2 CrossPos { get { return mCrossPos; } set { mCrossPos = value; } }

        private uint mStartHealth = 100;
        public uint mCurrentHealth;
        
        private uint mMaxAmmunition = 8;
        public uint mCurrentAmmunition;

        private float mReload;
        private float mReloadTime;

      
       

        public  Gunman(GraphicsDevice device, Vector2 position, Game theGame, SpriteBatch mSpriteBatch){
            mGame = theGame;
            mSprite = mSpriteBatch;
            this.mCrossPos = position;
            this.mCurrentHealth = mStartHealth;
            Initialize();
        }          

        private void Initialize()
        {
            mTexture = mGame.Content.Load<Texture2D>("Assets/Crosshairs");
            Console.WriteLine("Crosshairs Visible");
        }

        public void BANG()
        {
            Console.WriteLine("Bang");
        }

        public void Update(GameTime gameTime)
        {
            mCrossPos = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
           if (mMouseManager.MouseState.LeftButton == ButtonState.Pressed && mMouseManager.MouseState.LeftButton != ButtonState.Released)
           { BANG(); }
        }

        public void Draw(GameTime gameTime)
        {
            mSprite.Begin();
            mSprite.Draw(mTexture, mCrossPos, Color.White);
            mSprite.End();

        }
    }
    
}
